UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aWvI1agoxSRPcTz6oWIbXTvXdvRh13pIPOyx4qbvsnI=' 
WHERE 
  key_id = '207b2b98568fee367b0a07820665df9aa71c5983a79a3ea278df422709929f52' 
  AND (
    token = 'aWvI1agoxSRPcTz6oWIbXTvXdvRh13pIPOyx4qbvsnI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046