UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WduTjE51zjvk5cmNJ8iH59pLt1U7cUX0O7dfnH/GOxU=' 
WHERE 
  key_id = '3fb76b70b08e1445074554dfb9ec96a313de642591f26da7c85bc196b9b96672' 
  AND (
    token = 'WduTjE51zjvk5cmNJ8iH59pLt1U7cUX0O7dfnH/GOxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034