UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7KWLBMD6o1bvaKvj16IQVnQwCIkkzDThxiWXXuVWlx4='
WHERE
key_id = 'ba97f46dce212ddc55a02ede9dc750f60205a9fce791dc0a8769b6c774c58cf9'
AND (
token = '7KWLBMD6o1bvaKvj16IQVnQwCIkkzDThxiWXXuVWlx4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)