UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aybUbgdj2mNSv6+f72zakoWOHg/bG1c911WETeV0nuY=' 
WHERE 
  key_id = 'be6e423fc752c43858ec3e3ea8ae94dc5c2311a8601f2cfd047a8ba571fdf460' 
  AND (
    token = 'aybUbgdj2mNSv6+f72zakoWOHg/bG1c911WETeV0nuY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033