UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XMoDn6l+wiFZ8nCz9LRq+CbCJwgSov14hHbSBBi1hKU=' 
WHERE 
  key_id = '733922fb51947df57d8585f4b79c2276aeb82e68860e69528a3e876c78be7437' 
  AND (
    token = 'XMoDn6l+wiFZ8nCz9LRq+CbCJwgSov14hHbSBBi1hKU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036