UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DHsMwH1TwOjX2Jbp8skBukyrtRQIkGgC+vvWNXas+Kk=' 
WHERE 
  key_id = '6611c36df799597e3bd8cd3222a443ad384adf18d79565cfc6d2047582d7e508' 
  AND (
    token = 'DHsMwH1TwOjX2Jbp8skBukyrtRQIkGgC+vvWNXas+Kk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019