UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SJKUC9Mo205Yqaa02mKluuRcaiOw8vJSrCZdjQWN7Do=' 
WHERE 
  key_id = '51a303eb1e072ffee26264596eee6e29edbdc4890a44da6903d951c0f402cecb' 
  AND (
    token = 'SJKUC9Mo205Yqaa02mKluuRcaiOw8vJSrCZdjQWN7Do=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040