UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O3Gw2Tq9uX5pvCDWecRFxWyTTccLwC8UoWZUi2LnZxU=' 
WHERE 
  key_id = '874d850eee25b5761a600ce8850a6d6d71d5cb3acf073d316efdccb03e69c4a3' 
  AND (
    token = 'O3Gw2Tq9uX5pvCDWecRFxWyTTccLwC8UoWZUi2LnZxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053