UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dzfNz9Wed4LH0CKN7J1h6LI60ncu7oq+FuJsl3X8vVo='
WHERE
key_id = '1922ed1b861af0210282ae2a5c8b71bc962bec6673a06280986fd8c57f8d1700'
AND (
token = 'dzfNz9Wed4LH0CKN7J1h6LI60ncu7oq+FuJsl3X8vVo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)