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