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