UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I8LX59Fa7Kvjh37K1TkvyVwM00P8dM4OfQkX+V1OtY4='
WHERE
key_id = '1ca0b73d72f01d26c5a87bcaf184d9574ca9f295af83593771ccbf9c76392ff1'
AND (
token = 'I8LX59Fa7Kvjh37K1TkvyVwM00P8dM4OfQkX+V1OtY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)