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