UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9oLy7mT7finNqkYxixGbrhW5YK8aAQ1qdgajHlYN0P8=' 
WHERE 
  key_id = '9b02fa42d19dfca74e413a5bc82404540852c3d3e5fe65a8daca93d406a32040' 
  AND (
    token = '9oLy7mT7finNqkYxixGbrhW5YK8aAQ1qdgajHlYN0P8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037