UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q89xqfsgE60h5llaRwaZG3jZeVT9ziE5LwwIcoH5OXk=' 
WHERE 
  key_id = '373273eb047c2e10b20e4be02063804cd5ce699d7550221dad42567e82dc1ded' 
  AND (
    token = 'q89xqfsgE60h5llaRwaZG3jZeVT9ziE5LwwIcoH5OXk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026