UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LkNPxTXbfiJWWrb7Me7zOVZhbBEalh+tyZ7500hzCys=' 
WHERE 
  key_id = 'a84565abed5680c4338560e235d996f19d6cabea7e56b3d03d80b06717917b50' 
  AND (
    token = 'LkNPxTXbfiJWWrb7Me7zOVZhbBEalh+tyZ7500hzCys=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034