UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dGog/Ka5CAv8Tgn/qv5ejxTE4O0o6jvaLnTFoyxgIHs=' 
WHERE 
  key_id = '046d32fbde82c2869d130597509247d16aa2ad527e3787d4fab7b0afb3425287' 
  AND (
    token = 'dGog/Ka5CAv8Tgn/qv5ejxTE4O0o6jvaLnTFoyxgIHs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051