UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V4dYbW4ye/aTLRU0RYrMoi0dhh6aQB4uDuOPkmUFVj8='
WHERE
key_id = '8400d3e8f1e48e87b945e9ae8e188e161096043c5818e2fbf4dfe1ca4677e012'
AND (
token = 'V4dYbW4ye/aTLRU0RYrMoi0dhh6aQB4uDuOPkmUFVj8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)