UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5J05eH/AmPpiZOjeYkJ9lkjKsN8nl9u51Qi/Cg/5Y5k='
WHERE
key_id = '382581fdb630bce56dad98c1bdab93bc9133e16f9f94e0dc22f664408e1def65'
AND (
token = '5J05eH/AmPpiZOjeYkJ9lkjKsN8nl9u51Qi/Cg/5Y5k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)