UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AhBKpMPbmf3INOqcud/R93Xi2CulT2aSlrqwvmuv+8k='
WHERE
key_id = '8651a2a1d28aca446bf10c2e535c9688dc9d8d2f37a2a01001b202efe00c558c'
AND (
token = 'AhBKpMPbmf3INOqcud/R93Xi2CulT2aSlrqwvmuv+8k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)