UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oPQniirQHEDM4Aiuc1d44C3toEK70/znHsBVV9vjwhM=' 
WHERE 
  key_id = 'd6233686640320acbc3ae8cd2a0f70e36f14d94228ea407b7c76f3b33577f306' 
  AND (
    token = 'oPQniirQHEDM4Aiuc1d44C3toEK70/znHsBVV9vjwhM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023