UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eWG0RHmIsG4wsSO+6SLwPA4ZkvEc/UJbhHRTni+rlgw=' 
WHERE 
  key_id = '3d0a79572d332df111bb490b4cf458142ff5857e1c2bf9819e8c582747dc28d3' 
  AND (
    token = 'eWG0RHmIsG4wsSO+6SLwPA4ZkvEc/UJbhHRTni+rlgw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023