UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DNCYC+2rWzGaQMnZJGHaZamDUlTNkYsmbfMwB8HfI1k=' 
WHERE 
  key_id = '0cbe9ee3df2f906529b7c97ca9d5ac063941435faeafd0794f23557e0133c931' 
  AND (
    token = 'DNCYC+2rWzGaQMnZJGHaZamDUlTNkYsmbfMwB8HfI1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039