UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nT9OQ4sB9o5256KKLBHPCcrKbUCQYzLofH/b8sagCjc='
WHERE
key_id = 'c23c291ecd5e3610f14ab1ea68c874fd7f87095a61f60ac571df7ac6d1b56c41'
AND (
token = 'nT9OQ4sB9o5256KKLBHPCcrKbUCQYzLofH/b8sagCjc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)