UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yB3Wp5sCxZEcM+PaRexfJFOG8t7iMSY/E6ZNTzB/edM=' 
WHERE 
  key_id = '294ac29a82e55c46b8e7a7f7e637e23146d1548ca163383b2685d9e916138b81' 
  AND (
    token = 'yB3Wp5sCxZEcM+PaRexfJFOG8t7iMSY/E6ZNTzB/edM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034