UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AEiEY5cBq2J4pFXdxVqJAwRytZdi+PSH9odx3zrOHas=' 
WHERE 
  key_id = 'a326193ffd875da864f156171f76b961f0bc519a8fce52c56958f12320e7656d' 
  AND (
    token = 'AEiEY5cBq2J4pFXdxVqJAwRytZdi+PSH9odx3zrOHas=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033