UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dHMcQyixdv2oRa+z417/Pxw29Ki9ySbZo3wh6rXnlRA=' 
WHERE 
  key_id = 'b9f2f6d4627b4099918cc449b630914e813d77e7d32fb64640e126119af292e7' 
  AND (
    token = 'dHMcQyixdv2oRa+z417/Pxw29Ki9ySbZo3wh6rXnlRA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023