UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ld+yjC4CM4NwqxpUk9n5CqeC9W/a/7cw6epZ9CCysiE=' 
WHERE 
  key_id = '459b6ac19919fafe50c186b96e347aca20e1b08626294f692b4a5f1662f8f3a1' 
  AND (
    token = 'Ld+yjC4CM4NwqxpUk9n5CqeC9W/a/7cw6epZ9CCysiE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047