UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IZzqDlt6lhPx4m20Ou0A+XzDKZoIYdMqwH4II8RAlAk=' 
WHERE 
  key_id = '9966a47759a3d2fa51fbbf64650f3ba047cb7960aee348654ea8a4d352c7a04f' 
  AND (
    token = 'IZzqDlt6lhPx4m20Ou0A+XzDKZoIYdMqwH4II8RAlAk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032