UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yXVXSU+dxOU0nwsBQLIVviv4oXbiT46bhUmEE4a+ev4=' 
WHERE 
  key_id = 'bf6478dd8133c5611a7920faa6e8e105460beffbdf3a06bc310718eba5e55e5c' 
  AND (
    token = 'yXVXSU+dxOU0nwsBQLIVviv4oXbiT46bhUmEE4a+ev4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057