UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NxdIzmD9oyC0QhHRbLuihByn4tk1rfx7HrUffnXLaK8='
WHERE
key_id = '17002ceb46ad8044b2175f50e80b1db16891d668a0af915c73b570415e212891'
AND (
token = 'NxdIzmD9oyC0QhHRbLuihByn4tk1rfx7HrUffnXLaK8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)