UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uj5vqTh75bAwToyd2p0UADgQ+zaqmg+W9Hw8hPyNwOw=' 
WHERE 
  key_id = '951ffd170c245fe0f13509433c75671dddcbc2e17c24d04be56cfaca01cb93c9' 
  AND (
    token = 'uj5vqTh75bAwToyd2p0UADgQ+zaqmg+W9Hw8hPyNwOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047