UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wH3irTxb1kfVM6HwL1Pzmb1mIjgredNrwyFoO2TtvnA=' 
WHERE 
  key_id = '4aa4121ace2cd535e13e71db99c1b17db3fa261d905a33b4d77696de2c31e23d' 
  AND (
    token = 'wH3irTxb1kfVM6HwL1Pzmb1mIjgredNrwyFoO2TtvnA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050