UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TZWCDfURc2vpSTllupM+lYdiXGcv0UmsRq3qEjgB4ME=' 
WHERE 
  key_id = '6f36b3ca4181438da42d2a5f4475582ea95008f572af7181ce9537c40a984da6' 
  AND (
    token = 'TZWCDfURc2vpSTllupM+lYdiXGcv0UmsRq3qEjgB4ME=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050