UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NufUq3/+k5xJryvk+4FPpRbE79MFo8NYse5Qx8SBiB4='
WHERE
key_id = '305df5ac84213ad70ef34711ecf835c094afa6f58a2afcabb325622102f263ed'
AND (
token = 'NufUq3/+k5xJryvk+4FPpRbE79MFo8NYse5Qx8SBiB4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)