UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uQz6koV57iH4hM7z+XU0xT1rhn+V4nu4wrcJeBTeMAQ='
WHERE
key_id = 'afd58beee00e6bf864e5274c354271a33119f1ea2af86c8891e2a6f74358c958'
AND (
token = 'uQz6koV57iH4hM7z+XU0xT1rhn+V4nu4wrcJeBTeMAQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)