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