UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A9r8h+5dlq4RKlv8gBJcJscIJz6Mu/RT0vdot4VMwCQ='
WHERE
key_id = 'ac662e5f0b0da4ef97560254ffb1096798fd22e19d843791753f1ad8b410559d'
AND (
token = 'A9r8h+5dlq4RKlv8gBJcJscIJz6Mu/RT0vdot4VMwCQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)