UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HH/ffhLGmarxZ3AIHv+nZDUTLOQEwbpsSEnt8zXLdYE=' 
WHERE 
  key_id = '745420fc07f51eae5d207e818d875e354697db1ba2145c608137414937d44be9' 
  AND (
    token = 'HH/ffhLGmarxZ3AIHv+nZDUTLOQEwbpsSEnt8zXLdYE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016