UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZJQjiS/FyYQNs4GYnfftsdsgs9uONFGSZibxGhdO3fU=' 
WHERE 
  key_id = 'f8e108d1eb365210c3ed28a95d107c88121941f4f47f9ed1567344432aab9682' 
  AND (
    token = 'ZJQjiS/FyYQNs4GYnfftsdsgs9uONFGSZibxGhdO3fU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061