UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nSL9SQFmcQbVTlwEGKH7P0u3v4GLB8bGMXl0saW+jaA=' 
WHERE 
  key_id = '7e40f920fe9a9d3fc9ae95a87b03f64837a324cff722bba0fd91e74370db2175' 
  AND (
    token = 'nSL9SQFmcQbVTlwEGKH7P0u3v4GLB8bGMXl0saW+jaA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046