UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AI6Sld8+IElcVyAbsKow5SFUEEOEYnEAkwyN3pmRSV4='
WHERE
key_id = 'b33c04b6ace7c21bb909b775caf1e221c92899eeaaf401b4beb42c60b6118d0a'
AND (
token = 'AI6Sld8+IElcVyAbsKow5SFUEEOEYnEAkwyN3pmRSV4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)