UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'noCBaI0/tt3GlI0AMS3sNglZqnC9kCY76RH+R58bt1M='
WHERE
key_id = 'd5e8784d079d17285ae590f898a0ec3c28794aef4fd8440a969cbf913f559589'
AND (
token = 'noCBaI0/tt3GlI0AMS3sNglZqnC9kCY76RH+R58bt1M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)