UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dm8dQ6OcwEKRFz87l/S1pF+Oui7dO7fgQ1Q7NtFnQQg=' 
WHERE 
  key_id = '59b12882ff441aeccf58ff1d944e3127dcd8089b7d28139e80d8ab7f6b39bbfe' 
  AND (
    token = 'dm8dQ6OcwEKRFz87l/S1pF+Oui7dO7fgQ1Q7NtFnQQg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033