UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dbOJqXhKAq5O5wfZtyEC3YyuUUCcBbk8vqWl9oOyqLU=' 
WHERE 
  key_id = '3234bf76511c4d71c4631eee987d7e5d56d44330eebf1ca1080a6948abe4834f' 
  AND (
    token = 'dbOJqXhKAq5O5wfZtyEC3YyuUUCcBbk8vqWl9oOyqLU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038