UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IfD9M2ASRVPDlTR+Gq8M7YndPRnRXAW/Cah0+R0dFng=' 
WHERE 
  key_id = '05213ae459c629903b881138a2142a8bd4e98bb2ef2edccff429ebea1020115a' 
  AND (
    token = 'IfD9M2ASRVPDlTR+Gq8M7YndPRnRXAW/Cah0+R0dFng=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023