UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gBwKqhW+CmZhhGW3NoX8QPmWLuXnEd4z5OGcUK9iIto=' 
WHERE 
  key_id = 'c66828b2a10a8696cd16617ce67802996427e7260f8d84b109d3d9ea6516a1db' 
  AND (
    token = 'gBwKqhW+CmZhhGW3NoX8QPmWLuXnEd4z5OGcUK9iIto=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049