UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JanFKnCbsJhnr6QLLMss8b00AkBb+spdEZ+Xaq3avpk=' 
WHERE 
  key_id = '0c391800e2eae0335e4a377b58a2bb440ed26254cd9eac33993b4648c4c70f0b' 
  AND (
    token = 'JanFKnCbsJhnr6QLLMss8b00AkBb+spdEZ+Xaq3avpk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023