UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oKMW8vgRBOQbk/rRk4fcKaDPABLPs2z/5Orbd4CNY1Q='
WHERE
key_id = '399dc05447813a02e04af49a261b958fd75aeb8183f977d32655f3ba338d2a52'
AND (
token = 'oKMW8vgRBOQbk/rRk4fcKaDPABLPs2z/5Orbd4CNY1Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)