UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nJdkIubp3dbFLSOEkzRORwn9DAgEk5JwzlienrBTELI=' 
WHERE 
  key_id = '3b3af35fd0775422fa4a9dd7d5e03e29f6108e951d83cc2d88673d4c4740d9d8' 
  AND (
    token = 'nJdkIubp3dbFLSOEkzRORwn9DAgEk5JwzlienrBTELI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054