UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kkYyd0hSXl5lVz8bW8XQnA+XZVXdZej/ra7+7WGwJJw=' 
WHERE 
  key_id = 'bfe3758315479857fae53c8773915a58a079f26266c6fb657c30c06744936697' 
  AND (
    token = 'kkYyd0hSXl5lVz8bW8XQnA+XZVXdZej/ra7+7WGwJJw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036