UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RQNGZ9EYTfggrlkR1XeBIDMasA15yls0KPSP8obj990=' 
WHERE 
  key_id = 'ea567d14a7f3f1ddea29bf67d435f4c51388c91e09a1aae28839b04bb9b12735' 
  AND (
    token = 'RQNGZ9EYTfggrlkR1XeBIDMasA15yls0KPSP8obj990=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029