UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f2ntgVN56LVsyOq0WUW8OWQWiqRUHOB50cDbiCw1GzI=' 
WHERE 
  key_id = '14d4678c6681f906e366e6d6850b4ed050e2b9fe55887caa52d1c2a83b73ba13' 
  AND (
    token = 'f2ntgVN56LVsyOq0WUW8OWQWiqRUHOB50cDbiCw1GzI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028