UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CjlWfRfseadBMiKPDKpjVXRHU7+/r0Eqpy2n+lOJGH0=' 
WHERE 
  key_id = 'a33de97a72b4594bdbcd67796ea707e411f473b354777cef0d0b7b4acc92f02e' 
  AND (
    token = 'CjlWfRfseadBMiKPDKpjVXRHU7+/r0Eqpy2n+lOJGH0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042