UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YsWZht3BLzXmkmoGaq+j4m6gD1vBpDC1+qS1Lvx7Fhg=' 
WHERE 
  key_id = '126ba96051cafba36d532879485df226dda3a92c9b74075921d3ac62735aab37' 
  AND (
    token = 'YsWZht3BLzXmkmoGaq+j4m6gD1vBpDC1+qS1Lvx7Fhg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027