UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jmLx+fdvp12O/XdzqV9GHPaAohMipkJoEnmvO6zAcVs=' 
WHERE 
  key_id = '7a7469d9747285f7c2d53060b36584cdc7553b478f0b033bad52fe3b24e533ac' 
  AND (
    token = 'jmLx+fdvp12O/XdzqV9GHPaAohMipkJoEnmvO6zAcVs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036