UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gMcE/4c0KHSn6/QxuMCaF/UgGe0zCBW13Z7L6V2hTAU='
WHERE
key_id = 'a71d77c06e8f9f667e67c3b539c7d846aede36cd233d5f999b017b47dd70f613'
AND (
token = 'gMcE/4c0KHSn6/QxuMCaF/UgGe0zCBW13Z7L6V2hTAU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)