UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nW+LBTEZd93xoOBCQj3SaRxvWKGRfaAdhNPlcHcBNbI=' 
WHERE 
  key_id = 'a10b7f1f364c2bc904e59e38921ca2880fcadc0b64c79c22cf7d707bc8f2eb3e' 
  AND (
    token = 'nW+LBTEZd93xoOBCQj3SaRxvWKGRfaAdhNPlcHcBNbI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030