UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'teG8rBkFFNltgvW8WwKz0oOA18yzmVKuqYaglkRk/Xk=' 
WHERE 
  key_id = '8236f7a2f1e20097601798632d0be73cbdf2201b8805830cef46f9184518beb1' 
  AND (
    token = 'teG8rBkFFNltgvW8WwKz0oOA18yzmVKuqYaglkRk/Xk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030