UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mYQ4s5LogUrnBFDRqGSdpBqAzM2Ig7KfIZo+6Ec2GRo=' 
WHERE 
  key_id = '38387a90ee9ea5664db7bf1509e2b83820d44436b0e8bff6a64219e65f6e94f4' 
  AND (
    token = 'mYQ4s5LogUrnBFDRqGSdpBqAzM2Ig7KfIZo+6Ec2GRo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034