UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8REePs4YeQSnN2Ox3g0a0MCsCWoSNQwtqztjZILU5wo='
WHERE
key_id = '79472c8f6a38a3cc9260f38504a2eb001d2af54b5fd0a8120822854ca2c02565'
AND (
token = '8REePs4YeQSnN2Ox3g0a0MCsCWoSNQwtqztjZILU5wo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)