UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oR81uzuqeLemvboyINgiXjoeT8mqA1tgVc24Z7Cifbs=' 
WHERE 
  key_id = '669174e9cc44b1381126806ecaced2724cbeaa60bab69826270e747f89db208e' 
  AND (
    token = 'oR81uzuqeLemvboyINgiXjoeT8mqA1tgVc24Z7Cifbs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029