UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '47TP7sEJqnZlFyahFr5+7D+0TYEIMgFo+2k/uDKAvlU='
WHERE
key_id = 'dad6793e4b179b6a46904f39d64c044cd2b754c68fa37f741d97ab4f738a31ce'
AND (
token = '47TP7sEJqnZlFyahFr5+7D+0TYEIMgFo+2k/uDKAvlU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)