UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NcGYyPsTvQJBahHGWD3uDtoNO8lVaqHlkK0qABb7oGg='
WHERE
key_id = '04506ea0ccfcdb359a5e2bb7742d5e569c397f928b4b2694605f88f95e4391ca'
AND (
token = 'NcGYyPsTvQJBahHGWD3uDtoNO8lVaqHlkK0qABb7oGg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)