UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xaLl6JCxh8FxVd31qUvedvMBd1CxU7F714qC2aZ8nkU='
WHERE
key_id = 'f743224b6b7e7770d0f6463d610a0def17b5dd14401deda9fa98b521dc16a968'
AND (
token = 'xaLl6JCxh8FxVd31qUvedvMBd1CxU7F714qC2aZ8nkU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)