UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bt8sdoHzGhJwhGzMhTLj3UMl1uGZhvF6odBR82lZgwg=' 
WHERE 
  key_id = 'a87da48d192bef0881ce0fe95af68ce553e6a383d6a1e408494c2c51afc254f7' 
  AND (
    token = 'bt8sdoHzGhJwhGzMhTLj3UMl1uGZhvF6odBR82lZgwg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023