UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XMnrSebQUgXN8G5aKddhHaKg0jzonlsun33/hw6srUM=' 
WHERE 
  key_id = '1d5bc0a3278cf052031f9821a40da26ef7c9b1e777ac6d7bd1c0cb61b40b5fcc' 
  AND (
    token = 'XMnrSebQUgXN8G5aKddhHaKg0jzonlsun33/hw6srUM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022